package scau.erps.test;
import java.awt.BorderLayout;

import org.jfree.chart.ChartFactory;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.ChartPanel;
import javax.swing.*;

public class JFreeChartTest3 extends JFrame{
 //constructor
 public JFreeChartTest3(){
       //构造DataSet
       DefaultPieDataset DataSet = new DefaultPieDataset();
       DataSet.setValue("apple", 300);
       DataSet.setValue("barara", 250);
       DataSet.setValue("pear", 410);
       DataSet.setValue("milk", 330);
       DataSet.setValue("cheese", 280);
  
      //创建饼图
       JFreeChart chart = ChartFactory.createPieChart3D("Catogram",
             DataSet, true, true, false);
      //用来放置图表
      ChartPanel panel = new ChartPanel(chart);
     JPanel jp = new JPanel();
     jp.add(panel, BorderLayout.CENTER);
     this.add(jp);
     this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
     this.setBounds(100, 100, 700, 500);
     this.setVisible(true);
 }
 public static void main(String [] args){
      new JFreeChartTest3();
   }

}